import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop007_查看发货单流程"


rderNo='1664355206190002'
firefox=openBrowser(url) #调用自定义函数打开网页,url的值是在testData文件中定义的
# 1.登录后台管理系统,地址是"http://localhost/dbshop/admin",
firefox.get(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
# 2.点击销售管理发货单界面。
DBshopEnterMenu2(firefox,'销售管理','发货单')
# firefox.find_elements_by_link_text('查看')[0].click()
firefox.find_element_by_xpath('//td[text()="%s"]/following-sibling::td[5]/a'%rderNo).click()
time.sleep(2)

s=firefox.find_element_by_xpath('//body').text
l="订单号"+rderNo+"  "
r="\)"
order_State=reGetString(s,l,r)
print(order_State) #order_State 是实际值
yuqi="未发货"
# #断言

if yuqi==order_State:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试不通过" % testCase)
    getPhoto(firefox)
# try:
#     firefox.find_element_by_xpath('//strong').is_displayed()
#     writeLog("%s 测试通过"%testCase)
# except:
#     writeLog("%s 测试失败" % testCase)
#     getPhoto(firefox)
firefox.quit()
